#!/bin/csh -f
#
# qsel: Script to select a residue/model range from a PDB file using AquaWhat 
# =============================================================
# Ton Rullmann, Oct 8, 1996 - Aqua 1.0
# =============================================================
# Argument 1: input file
#          2: ranges file
#          3: output file

if ( $#argv < 3 ) then
    echo 'usage: qsel  input_file  ranges_file  output_file'
    exit (1)
endif

if ( ! -e $1 ) then
    echo 'file' $1 'does not exist'
    exit (1)
endif
if ( ! -e $2 ) then
    echo 'file' $2 'does not exist'
    exit (1)
endif

setenv AQUAPROJECT tmp
$AQUABINDIR/AquaWhat set batch on read pdb $1 - select $2 set coordout pdb write selSet $3 quit > qsel.log
grep '^ *\*' qsel.log
echo ' '
echo 'QSEL - Log file: qsel.log'
